<template>
  <div class="menu-side">
    <el-menu
      default-active="/chat"
      class="el-menu-vertical-demo"
      :collapse="isCollapse"
      @open="handleOpen"
      @close="handleClose"
      router
    >
      <el-menu-item index="/chat">
        <el-icon>
          <IconChat />
        </el-icon>
        <template #title>聊天</template>
      </el-menu-item>
      <el-menu-item index="/translate">
        <el-icon>
          <IconTranslate />
        </el-icon>
        <template #title>翻译</template>
      </el-menu-item>
    </el-menu>
  </div>
</template>

<script lang="ts" setup>
import { ref } from 'vue'
import IconTranslate from '@/components/icons/IconTranslate.vue'
import IconChat from '@/components/icons/IconChat.vue'

const isCollapse = ref(true)
const handleOpen = (key: string, keyPath: string[]) => {
  console.log(key, keyPath)
}
const handleClose = (key: string, keyPath: string[]) => {
  console.log(key, keyPath)
}
</script>

<style>
.menu-side,
.el-menu {
  height: 100%;
}

.el-menu-vertical-demo:not(.el-menu--collapse) {
  width: 200px;
  min-height: 400px;
}
</style>
